<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/validate.jsp"%>
<%
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
	String date = sdf.format(new Date());
	List<String> shcedules = QBuilder.db("basedb").select("date").from("Schedule").where(new Where("hospital =", hospital).and("status = ", STATUS_ENABLE).and("date > ", date)).order("date", QBuilder.asc).query().getResultObj();
	if (shcedules.size() == 0) {
		msg = new Message(0, "没有相关排班信息");
		Tools.encryptPrint(out, msg);
		return;
	}
	String startTime = shcedules.get(0);
	String endTime = shcedules.get(shcedules.size() - 1);
	Map<String, String> time = new HashMap<String, String>();
	time.put("start_time", startTime);
	time.put("end_time", endTime);
	msg.put("data", time);
	Date date1 = sdf.parse(startTime);
	Date date2 = sdf.parse(endTime);
	int days = (int) ((date2.getTime() - date1.getTime()) / (1000*3600*24)) + 1;
	msg.put("days", days);
	Tools.encryptPrint(out, msg);
%>